Computer generated images are typically made up of many differing components or graphical elements which are "composited" or rendered together to create a final image. An image is separated into its constituent elements so that they can be independently rendered, thereby potentially saving large amounts of time due to the use of smaller image fragments. Each element or object has associated with it a particular matte or "Alpha Channel" information which generally includes coverage information designating the shape and transparent nature of the element. The matte or Alpha Channel information is normally stored separately for each pixel. Each pixel additionally normally stores the color components (for example Red, Green, Blue (RGB)) also for each pixel. Therefore, each pixel of an element can be represented by the quadruple (R, G, B, .alpha.) where .alpha. represents the transparency of an element and is known generally as the "Alpha" or opacity channel. As an example, if black of represented by the RGB color components 0,0,0), then the color black can be represented by the quadruple 0,0,0,1) and a clear or totally transparent color can be represented by the quadruple 0,0,0,0).
Furthermore it is sometimes advantageous to "premultiply" the color components by their opacity. In this case the color (R, G, B) is represented by (R, G, B) (.alpha.R, .alpha.G, .alpha.B).
Referring now to FIGS. 1 to 3 there will now be shown a simple example of image composition. In FIG. 1 there is shown an example of a circular graphical element 1 whose outline is defined by the edge of the circle. Inside the circle there is defined a particular color or variation thereof 2. The exterior 3 of the circular border is assumed to be of infinite extent and is defined to take an alpha value of zero (ie. invisible). In FIG. 2 there is shown a second circular graphical element 4 having a different color 5 from the color of the element 1 of FIG. 1. In FIG. 3, there is shown an example of a more complex image 6 formed from the compositing of one copy of each of the elements, 1, 4 of FIGS. 1 and 2 on to a page. An overlap portion 7 is defined to be a combination of the two elements 1, 4 and takes a color value which is dependent on the compositing operators combining the two elements to create a more complex image 6.
Thomas Porter and Tom Duff, in an article entitled "Compositing Digital Images" appearing in Computer Graphics, Vol. 18, No. 3, July 1984 at pages 253-259 set out a method for compositing elements together to form "super-elements". Porter and Duff also discuss methods of combining two images wherein both images have an ".alpha." channel. There are 13 main compositing operations for combining two portions of a single image. The function of each of those compositing operations is as set out in Table 1 below where Dc is the premultiplied destination or resultant color, Do is the destination or resultant .alpha. channel value, Ac is the premultiplied pixel color of a first portion of a first source A, Ao is the .alpha. value corresponding to the pixel whose color is Ac, Bc is the premultiplied pixel color value of a portion of an image of a second source B, and Bo is the .alpha. channel value of the pixel corresponding to Bc of the source B.
TABLE 1 Compositing Operations OPERATION EQUATION clear Dc = 0 Do = 0 A Dc = Ac. Do = Ao B Dc = Bc Do = Bo A over B Dc = Ac + Bc(1 - Ao) Do = Ao + Bo(1 - Ao) A rover B Dc = Ac(1 - Bo) + Bc (Reverse case of A over B) Do = Ao(1 - Bo) + Bo A in B Dc = AcBo Do = AoBo A rin B Dc = AoBc (Reverse case of A in B) Do = AoBc A out B Dc = Ac(1 - Bo) Do = Ao(1 - Bo) A rout B Dc = Bc(l - Ao) (Reverse case of A out B) Do = Bo(1 - Ao) A atop B Dc = AcBo + Bc(1 - Ao) Do = AoBo + Bo(1 - Ao) A ratop B Dc = Ac(1 - Bo) + BcAo Do = Ao(1 - Bo) + BoAo A xor B Dc = Ac(1 - Bo) + Bc(1 - Ao) Do = Ao(1 - Bo) + Bo(1 - Ao) A plusW B Dc = Ac + Bc (with Dc "wrap around") Do = Ao + Bo (with Do "wrap around") A plusC B Dc = Ac + Bc (with Dc "clamped") Do = Ao + Bo (with Do "clamped")
In Table 1 there are shown various methods for combining two different images together utilising different operators. Additional operators to those used above are possible. The additional operators can be mainly utilized to implement special effects.
The "wrap around" nature of the "plusW" operator means that when, for example, the addition of Ac+Bc is greater than a maximum value of a color component, the value is "wrapped around" to start again with reference to the minimum value in the color space. Alternatively, the process of "clamping" utilized by "plusC" involves clamping the addition of, for example, Ac+Bc to the maximum value of a color component when the addition is greater than this component.
Referring now to FIG. 4, there are shown various examples of the final image which is created when various operations as set out in Table 1 are utilized in the compositing of two fully opaque circles A and B. It should be noted that the operators "rover", "rin", "rout" and "ratop" are equivalent to the swapping of the operands to the "r" (reverse) operator and applying the corresponding operator "over", "in", "out" and "atop" respectively.
Recently, graphics languages in the form of page description languages such as POSTSCRIPT (Trade Mark) have become available. These language offer the full functionality of a relatively complex programming language, thereby allowing complex images to be described compactly through the use of notions of iteration, control flow and procedural definition of image elements. These page description languages were developed to insulate the application writer from any machine dependent details of printers, thereby aiding portability. These languages offer extensive support for text, spline-based graphical objects and sampled images. An interpreter for the language can then be constructed and reside in, for example, a printing device, allowing a complex image to be represented compactly. Additionally, page description languages aid in portability from one output device to another, as the interpretation of the language can be machine independent. Languages such as POSTSCRIPT were originally constructed to describe the appearance of a bit map page or screen and utilize certain graphic primitives that are based on the notion of painting with opaque paint on the bit map image.
As in most programming languages, page description languages often consist of operands and operators which act on the operands to produce new results or effects. The operands may sometimes include fundamental graphical entities such as a line, an arc, a curve, a collection of lines and splines, a string of text, or a sampled image, and are designed to be operated on by the operators. The operators can be classified into many different categories including the following:
1. Operators which determine current attributes of various operands or global status variables. PA1 2. Operators which alter the various coordinate systems in which fundamental entities are to be defined. PA1 3. Path operators which update certain basic entities to define various paths, thereby allowing the construction of complex objects. PA1 4. Various "rendering" operators which generate image data that eventually determines the color of the individual dots which appear on an output page. PA1 5. A special class of operators is normally used for specifying, modifying and selecting text or fonts. This is due to the special nature of character fonts which are pre-prepared and in constant use. PA1 6. Various device setup and output operators which can be utilized to control the outputting of an image to a display device such as a printer or screen. PA1 parsing and executing a sequence of statements, said statements including the combining or rendering of graphical elements; PA1 converting said combining or rendering of graphical elements to be nodes of an expression tree wherein the descendants of said nodes are the operands of a deferred combining or rendering of graphical elements and the node is marked as having a deferred operation; and PA1 producing, from said expression tree, a series of instructions corresponding to said sequence of statements, said instructions having one operand operating on a plurality of operators.
Unfortunately, languages such as POSTSCRIPT and the like rely on a "device model" directed to the painting with opaque paint on a frame buffer or the like. The use of a frame buffer requires excessive amounts of storage, and, with modern imaging techniques requiring high quality output, this can often lead to excessive amounts of storage and computation being required to create an image. Additionally, the inefficiencies in the use of painting techniques becomes accennuated with increase output resolutions.